/**
 * @author Robot , All Rights Reserved
 * Created On 2015年5月10日,上午12:30:51
 */
package com.dsh.vegetable.dao.impl;

import java.util.List;

import javax.annotation.Resource;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import com.dsh.vegetable.dao.VegetableDao;
import com.dsh.vegetable.entity.Vegetable;

/**
 * @author robot
 *
 */
@Repository
public class VegetableDaoImpl implements VegetableDao {

	private SqlSessionTemplate sqlSession;
	@Resource(name="sqlSession")
	public void setSqlSession(SqlSessionTemplate sqlSession) {
		this.sqlSession = sqlSession;
	}
	
	
	/* (non-Javadoc)
	 * @see com.dsh.vegetable.dao.VegetableDao#getListById(com.dsh.vegetable.entity.Vegetable)
	 */
	@Override
	public List<com.dsh.vegetable.entity.Vegetable> getListById(
			com.dsh.vegetable.entity.Vegetable bean) {
		// TODO Auto-generated method stub
		List<Vegetable> list = sqlSession.selectList("Vegetable.getListById",bean);
		return list;
	}

	/* (non-Javadoc)
	 * @see com.dsh.vegetable.dao.VegetableDao#getListByShopId(com.dsh.vegetable.entity.Vegetable)
	 */
	@Override
	public List<com.dsh.vegetable.entity.Vegetable> getListByShopId(
			com.dsh.vegetable.entity.Vegetable bean) {
		// TODO Auto-generated method stub
		List<Vegetable> list = sqlSession.selectList("Vegetable.getListByShopId",bean);
		return list;
	}

	/* (non-Javadoc)
	 * @see com.dsh.vegetable.dao.VegetableDao#getListByGroupId(com.dsh.vegetable.entity.Vegetable)
	 */
	@Override
	public List<com.dsh.vegetable.entity.Vegetable> getListByGroupId(
			com.dsh.vegetable.entity.Vegetable bean) {
		// TODO Auto-generated method stub
		List<Vegetable> list = sqlSession.selectList("Vegetable.getListByGroupId",bean);
		return list;
	}

	/* (non-Javadoc)
	 * @see com.dsh.vegetable.dao.VegetableDao#getListByCreateDate(com.dsh.vegetable.entity.Vegetable)
	 */
	@Override
	public List<com.dsh.vegetable.entity.Vegetable> getListByCreateDate(
			com.dsh.vegetable.entity.Vegetable bean) {
		// TODO Auto-generated method stub
		List<Vegetable> list = sqlSession.selectList("Vegetable.getListByCreateDate",bean);
		return list;
	}

	/* (non-Javadoc)
	 * @see com.dsh.vegetable.dao.VegetableDao#getListByUpdDate(com.dsh.vegetable.entity.Vegetable)
	 */
	@Override
	public List<com.dsh.vegetable.entity.Vegetable> getListByUpdDate(
			com.dsh.vegetable.entity.Vegetable bean) {
		// TODO Auto-generated method stub
		List<Vegetable> list = sqlSession.selectList("Vegetable.getListByUpdDate",bean);
		return list;
	}

	/* (non-Javadoc)
	 * @see com.dsh.vegetable.dao.VegetableDao#getListByCreateId(com.dsh.vegetable.entity.Vegetable)
	 */
	@Override
	public List<com.dsh.vegetable.entity.Vegetable> getListByCreateId(
			com.dsh.vegetable.entity.Vegetable bean) {
		// TODO Auto-generated method stub
		List<Vegetable> list = sqlSession.selectList("Vegetable.getListByCreateId",bean);
		return list;
	}

	/* (non-Javadoc)
	 * @see com.dsh.vegetable.dao.VegetableDao#getListByUpdDateId(com.dsh.vegetable.entity.Vegetable)
	 */
	@Override
	public List<com.dsh.vegetable.entity.Vegetable> getListByUpdDateId(
			com.dsh.vegetable.entity.Vegetable bean) {
		// TODO Auto-generated method stub
		List<Vegetable> list = sqlSession.selectList("Vegetable.getListByUpdDateId",bean);
		return list;
	}

	/* (non-Javadoc)
	 * @see com.dsh.vegetable.dao.VegetableDao#getListByVegetableName(com.dsh.vegetable.entity.Vegetable)
	 */
	@Override
	public List<com.dsh.vegetable.entity.Vegetable> getListByVegetableName(
			com.dsh.vegetable.entity.Vegetable bean) {
		// TODO Auto-generated method stub
		List<Vegetable> list = sqlSession.selectList("Vegetable.getListByVegetableName",bean);
		return list;
	}

	/* (non-Javadoc)
	 * @see com.dsh.vegetable.dao.VegetableDao#getListByVegetableIntroduction(com.dsh.vegetable.entity.Vegetable)
	 */
	@Override
	public List<com.dsh.vegetable.entity.Vegetable> getListByVegetableIntroduction(
			com.dsh.vegetable.entity.Vegetable bean) {
		// TODO Auto-generated method stub
		List<Vegetable> list = sqlSession.selectList("Vegetable.getListByVegetableIntroduction",bean);
		return list;
	}

	/* (non-Javadoc)
	 * @see com.dsh.vegetable.dao.VegetableDao#getListByIsSale(com.dsh.vegetable.entity.Vegetable)
	 */
	@Override
	public List<com.dsh.vegetable.entity.Vegetable> getListByIsSale(
			com.dsh.vegetable.entity.Vegetable bean) {
		// TODO Auto-generated method stub
		List<Vegetable> list = sqlSession.selectList("Vegetable.getListByIsSale",bean);
		return list;
	}

	/* (non-Javadoc)
	 * @see com.dsh.vegetable.dao.VegetableDao#getListBySaleRate(com.dsh.vegetable.entity.Vegetable)
	 */
	@Override
	public List<com.dsh.vegetable.entity.Vegetable> getListBySaleRate(
			com.dsh.vegetable.entity.Vegetable bean) {
		// TODO Auto-generated method stub
		List<Vegetable> list = sqlSession.selectList("Vegetable.getListBySaleRate",bean);
		return list;
	}

	/* (non-Javadoc)
	 * @see com.dsh.vegetable.dao.VegetableDao#getListByIsRecommend(com.dsh.vegetable.entity.Vegetable)
	 */
	@Override
	public List<com.dsh.vegetable.entity.Vegetable> getListByIsRecommend(
			com.dsh.vegetable.entity.Vegetable bean) {
		// TODO Auto-generated method stub
		List<Vegetable> list = sqlSession.selectList("Vegetable.getListByIsRecommend",bean);
		return list;
	}

	/* (non-Javadoc)
	 * @see com.dsh.vegetable.dao.VegetableDao#getListByClickNum(com.dsh.vegetable.entity.Vegetable)
	 */
	@Override
	public List<com.dsh.vegetable.entity.Vegetable> getListByClickNum(
			com.dsh.vegetable.entity.Vegetable bean) {
		// TODO Auto-generated method stub
		List<Vegetable> list = sqlSession.selectList("Vegetable.getListByClickNum",bean);
		return list;
	}

	/* (non-Javadoc)
	 * @see com.dsh.vegetable.dao.VegetableDao#getListByPrice(com.dsh.vegetable.entity.Vegetable)
	 */
	@Override
	public List<com.dsh.vegetable.entity.Vegetable> getListByPrice(
			com.dsh.vegetable.entity.Vegetable bean) {
		// TODO Auto-generated method stub
		List<Vegetable> list = sqlSession.selectList("Vegetable.getListByPrice",bean);
		return list;
	}

	/* (non-Javadoc)
	 * @see com.dsh.vegetable.dao.VegetableDao#deleteVegetableById(com.dsh.vegetable.entity.Vegetable)
	 */
	@Override
	public int deleteVegetableById(com.dsh.vegetable.entity.Vegetable bean) {
		// TODO Auto-generated method stub
		try {
			sqlSession.delete("Vegetable.deleteVegetableById", bean);
			}
		catch(Exception e){
			e.printStackTrace();
		}
		return 0;
	}

	/* (non-Javadoc)
	 * @see com.dsh.vegetable.dao.VegetableDao#insertVegetable(com.dsh.vegetable.entity.Vegetable)
	 */
	@Override
	public int insertVegetable(
			com.dsh.vegetable.entity.Vegetable bean) {
		// TODO Auto-generated method stub
		int rs = sqlSession.insert("Vegetable.insertVegetable", bean);
		return rs;
	}


	@Override
	public int updVegetable(
			com.dsh.vegetable.entity.Vegetable bean) {
		// TODO Auto-generated method stub
		int rs = sqlSession.insert("Vegetable.updateVegetable", bean);
		return rs;
	}


}
